/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CreateASim2.java
 *
 * Created on Feb 25, 2010, 11:44:35 AM
 */

package gsim.editor;

import gsim.SimFrame;
import java.awt.Frame;
import java.awt.HeadlessException;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import sim.Simulation;

/**
 *
 * @author ae3263
 */
public class EditorToolFrame extends javax.swing.JDialog {

    public static Simulation showDialog(SimFrame parent, Simulation sim) {
        new EditorToolFrame(parent, sim, true).setVisible(true);
        return sim;
    }

    SimulationComponentList list;

    /** Creates new form CreateASim2 */
    public EditorToolFrame() {
        initComponents();
        list = new SimulationComponentList();
    }

    public EditorToolFrame(Frame owner, Simulation sim, boolean modal) throws HeadlessException {
        super(owner, sim.toString(), modal);
        initComponents();
        list = new SimulationComponentList(sim);
        Simulation.ACTIVE_SIM = sim; // set global variable context
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        editorTools1 = new gsim.editor.EditorToolPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        jScrollPane1.setViewportView(editorTools1);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 523, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private gsim.editor.EditorToolPanel editorTools1;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables

}
